#!/bin/bash

#镜像标签
TAG=1.0-SNAPSHOT
#远程HarborIP地址
REMOTE_IP=39.100.202.234
#远程Harbor项目名
REMOTE_PROJECT_NAME=hx
#镜像名称
IMAGE_NAME=hx-server-web
#容器名称
CONTAINER_NAME=hx-server-web

#首先移除原来的镜像
docker stop ${CONTAINER_NAME}
docker rm ${CONTAINER_NAME}
#删除本地的远程镜像副本
docker rmi ${REMOTE_IP}/${REMOTE_PROJECT_NAME}/${IMAGE_NAME}:${TAG}

#拉取镜像
docker pull ${REMOTE_IP}/${REMOTE_PROJECT_NAME}/${IMAGE_NAME}:${TAG}

#启动docker
sudo docker run -p 5566:5566 --name ${CONTAINER_NAME} -d ${REMOTE_IP}/${REMOTE_PROJECT_NAME}/${IMAGE_NAME}:${T AG}
